home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / prtcs155.zip / USERUL.WPL < prev    next >
Text File  |  1994-01-14  |  5KB  |  192 lines

  1. /**/
  2. v="$VER:  UserUL Wplrx    Get user upload descriptions   Williamson 54.09"
  3. /* Non-Secure Inbound directory     */
  4. /* Mail:Inbound/nonsecure/          */
  5. indir=addslash(dequote(getclip('INDIR')))||'NONSECURE/'
  6. /* TAGNAME of your SYSOP Feedback message base */
  7. sysopbase=GetClip('SYSOPBASE')
  8. /* Your name */
  9. sysop=GetClip('SYSOP')
  10. rpath=addslash(dequote(GetClip('REXXDIR')))
  11. options RESULTS
  12. options failat 99
  13. signal on syntax  
  14. signal on halt
  15. signal on ioerr
  16. signal on break_c
  17. signal on break_d
  18.  
  19. pragma("W","NULL")
  20. /* Check if ROOFLOG port is available */
  21. log=show('P','ROOFLOG')
  22.  
  23. sv      = 'v'||right(v,5)
  24. script  = "UserUL"
  25. mailer=GetCLip('SHELTER')
  26. l_mailer=lower(mailer)
  27.  
  28. cr    = '\r\n'  /* WPL */
  29. nl    = '0a'X   /* REXX */
  30. bs    = '08'x   
  31. quote = '"'
  32.  
  33. tmsg="T:User-"pragma('ID')
  34.  
  35. parse arg username
  36.  
  37. filefile='LOG:needdesc'
  38. if upper(username)="USER" then username="Unknown User"
  39.  
  40. if ~exists(filefile) then exit
  41. if ~open('rf',filefile,'r') then exit
  42.  
  43. do while ~eof('rf')
  44.     x=readln('rf')
  45.     if x="" then iterate
  46.     if words(x) ~= 2 then call PutLog("error:" x,10,10)
  47.     parse var x remfile localfile
  48.     desc=strip(wpl_prompt(200,cr||'Please describe 'remfile' (max: 79 characters)'||cr))
  49.     call PutLog('File:'localfile' Desc:'desc,10,10)
  50.     address COMMAND "FileNote" localfile '"'||desc||'"'
  51.     drop desc
  52.     x=upper(wpl_prompt(120,'Would you like to enter a long description? (y/N) '))
  53.     if x="Y" then call feedback
  54. end
  55. call close('rf')
  56. call delete(filefile)
  57. call send(cr||'Bye and Thanks for the uploads 'username||cr)
  58. exit
  59.  
  60.  
  61. /* feedback to sysop */
  62. feedback:
  63.     call send(cr||' To:                  'sysop)
  64.     call send(cr||' From:                'username)
  65.     call send(cr||' Subject:             'remfile)
  66.  
  67.     call send(cr||' Enter your message one line at a time.'||cr)
  68.     call send(cr||' Hit CR to select Save or continue.'||cr)
  69.  
  70.     call open('smsg',tmsg,"W")
  71.     call writech('smsg'," Long Description for "remfile" from "username" Posted:"date()" at "time()||nl)
  72.     editing=1
  73.     line=1
  74.     c=0
  75.     do while editing
  76.         do while resp ~= ""
  77.             'CheckCarrier'
  78.             if RC~=0 then leave
  79.             resp=wpl_prompt(200,"-->"line": ")
  80.             if resp ~= "" then do
  81.                 chars=writech('smsg',resp||nl)
  82.                 c=c+chars
  83.                 line=line+1
  84.             end
  85.         end /* hit a blank line */
  86.         'CheckCarrier'
  87.         if RC~=0 then do
  88.             call writech('smsg','User' username 'dropped carrier during feedback'||nl)
  89.             call PutLog('User' username 'dropped carrier during feedback',10,10)
  90.             call save_msg
  91.             call cleanup
  92.             exit
  93.         end
  94.         resp=wpl_prompt(120,cr||' You entered 'line-1' lines and 'chars' characters (total:'c'), [S]ave/[c]ontinue?'||cr)
  95.         if upper(resp)="S" then editing=0  
  96.     end  /* finished editing */ 
  97.  
  98.     call writech('smsg',nl)
  99.     call close('smsg')
  100.     call PutLog('Saving message from 'username' in 'sysopbase,10,10)
  101.     call send(cr||' Saving......')
  102.     if exists("RPDIR:SMSG") then do
  103.         cmd='RUN SMSG 'sysopbase tmsg '"'username'"' '"'sysop'"' remfile
  104.         address COMMAND cmd
  105.     end;else do
  106.         cmd=rpath'Smsg.rexx' sysopbase tmsg '"'username'"' '"'sysop'"' remfile
  107.         call PutLog('Executing:' cmd,10,10)
  108.         Address "AREXX" cmd
  109.     end
  110.     address   
  111.  
  112.     call send(cr||' Message saved, thanks' username||cr)
  113. return 0
  114.  
  115.  
  116. send:
  117.     'Print' quote||arg(1)||quote
  118.     'Send' quote||arg(1)||quote
  119. return
  120.  
  121. wpl_prompt:
  122.     'Print' quote||arg(2)||quote
  123.     'Send' quote||arg(2)||quote
  124. getstring:
  125.     'GetInbound E0 'arg(1)
  126.     'String $(event)'
  127.     if upper(RESULT) = 'CARRIER' then do
  128.         'RexxMsg NY "LOGPROC" "PutLog 'l_mailer'wpl $<time> $(line) UserUL $(remote.address) Lost Carrier"'
  129.         call PutLog('User 'username' dropped carrier',10,10)
  130.         call cleanup 
  131.         exit
  132.     end;else if upper(RESULT) = 'LOGIN' then do
  133.         'String $(namebuf)'
  134.         x=(RESULT) 
  135.     end;else x=""
  136. return x
  137.  
  138. get_fn:
  139.     if LastPos('/', arg(1)) ~= 0 then return SubStr(arg(1), LastPos('/', arg(1)) + 1)
  140.         else if LastPos(':', arg(1)) ~= 0 then return SubStr(arg(1), LastPos(':', arg(1)) + 1)
  141.             else return arg(1)
  142. lower:
  143. return(bitor(arg(1),'20'x))
  144.  
  145. PutLog:  procedure expose log script
  146.     if arg(2) > GetClip('LOGLEVEL') & ~log then return 0
  147.     address 'ROOFLOG' 'logline' left(time(),5) script': 'arg(1)
  148.     address   
  149. return 0
  150.  
  151. addslash:
  152.     curr = arg(1)
  153.     select
  154.         when right(curr, 1) = ":" then nop
  155.         when right(curr, 1) = "/" then nop    /* TackOn */
  156.             otherwise curr = curr"/"
  157.     end
  158. return curr
  159.  
  160. /* a useful procedure by Walt Sullivan    */
  161. dequote:
  162.     parse arg thing
  163.     parse var thing '"' unq_thing '"'
  164.     if unq_thing ~= "" then return unq_thing
  165. return thing
  166.  
  167. cleanup:
  168. return 0
  169. break_c:
  170. break_d:
  171.     PutLog('User abort',10,10)
  172.     call cleanup
  173.     exit 10
  174. novalue: 
  175.         call template_oops "Novalue" sigl
  176. syntax:
  177.         call template_oops "Syntax(RC=" || RC || ")" sigl RC
  178. failure:
  179.         call template_oops "Failure(RC=" || RC || ")" sigl
  180. ioerr:
  181.         call template_oops "IOErr" sigl 
  182. halt:
  183.         call template_oops "Halt" sigl 
  184.  
  185. template_oops:
  186.         parse arg what badline code
  187.         if code ~= "" then PutLog('ERR: Line 'badline what errortext(code),10,10)
  188.             else PutLog('ERR: Line' badline what,10,10)
  189.         call cleanup
  190.         exit(40)
  191. /**/
  192.